package com.example.springboot.pattern.strategy;

public class StrategyMain {
//    public static void main(String[] args) {
//        ShoppingCart cart = new ShoppingCart(new RegularDiscount());
//        cart.addItem(100);
//        System.out.println("Regular Discount: " + cart.checkout());
//
//        cart.setDiscountStrategy(new VIPDiscount());
//        cart.addItem(200);
//        System.out.println("VIP Discount: " + cart.checkout());
//
//        cart.setDiscountStrategy(new SuperVIPDiscount());
//        cart.addItem(300);
//        System.out.println("Super VIP Discount: " + cart.checkout());
//    }

    public static void main(String[] args) {
        LogisticsSystemWithStrategy logistics = new LogisticsSystemWithStrategy();

        // 根据区域动态设置策略
        logistics.setDeliveryStrategy(new DomesticDeliveryStrategy());
        System.out.println("Domestic delivery cost: " + logistics.calculateDeliveryCost(3));

        logistics.setDeliveryStrategy(new InternationalDeliveryStrategy());
        System.out.println("International delivery cost: " + logistics.calculateDeliveryCost(3));
    }
}
